
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Godot;

public class ActorMenuButtonComp
{
    private Dictionary<string, Button> buttonDict = new Dictionary<string, Button>();

    public void addButtons(Godot.Node2D parent, string[] nameList)
    {
        foreach (string name in nameList)
        {
            if (buttonDict.ContainsKey(name))
            {
                parent.AddChild(buttonDict[name]);
            }

        }
    }

    public ActorMenuButtonComp()
    {

        Button moveBtn = new Button();
        moveBtn.Text = "移动";
        moveBtn.Pressed += OnClickMove;

    }

    private void addButtonDict(string name, Action func)
    {
        if (!buttonDict.ContainsKey(name))
        {
            Button btn = new Button();
            btn.Text = name;
            btn.Pressed += func;
        }
    }

    private void OnClickMove()
    {
        /*EventParams param = new EventParams();
        param.paramDict.Add("moveRange", parent.leftMoveRange);
        param.paramDict.Add("beginPos", TileMapUtil.ChangePosToTile(parent.Position.X, parent.Position.Y));
        EventManager.getInstance().dispatchEvent(EventType.EVENT_TILE_MAP_SHOW_CAN_WAKL_RANGE, param);
        ViewManager.getInstance().close("ActorMenu");*/
    }

    private void onAttact()
    {
        GD.Print("噢噢噢噢，我打你了");
    }

    private void OnEndRound()
    {
        EventManager.getInstance().dispatchEvent(EventType.EVENT_END_GAME_ROUND);
        ViewManager.getInstance().close("ActorMenu");
    }
}